082b7b73325c720ed98249372ef8c1512bd41e41
[git-annex.git] /
1 [[!comment format=mdwn
2  username="joey"
3  subject="""comment 1"""
4  date="2022-01-11T16:25:50Z"
5  content="""
6 `git update-index` creates an index file. A repo with an index file is no
7 longer a bare repo to a certain extent, at least it is very unusual for a
8 repo to be both bare and contain an index file, since after all an index
9 file is a record of the files in the working tree. This seems to be the root
10 of the confusion.
11
12 I was able to reproduce this by simply copying `.git/index` from a non-bare
13 repo into the bare repo and then running `git-annex drop --all`.
14
15 Removing the index file was not sufficient to fix it. It turned out I also 
16 needed to delete `annex/keydb*`. Then things returned to normal.
17
18 So, it seems that the keys database is getting populated in a bare repo
19 when there's an index file, and once the keys database is populated, it
20 runs code paths that will not work in a bare repo, because that database
21 contains paths (taken from the index) that it treats as being present in a
22 nonexistant working tree. I've fixed it to both avoid populating the keys
23 database, and ignore a populated keys database in this situation.
24
25 But.. My suggestion is, if you need to do this kind of thing in a bare repo,
26 set `GIT_INDEX_FILE` to some other file. That's how git-annex makes similar
27 tree objects.
28 """]]